﻿package mortal.game.view.heroArena.renderer
{
    import Message.Public.*;
    import com.greensock.layout.*;
    import com.mui.controls.*;
    import extend.language.*;
    import flash.events.*;
    import mortal.common.*;
    import mortal.common.global.*;
    import mortal.game.manager.*;
    import mortal.game.mvc.*;
    import mortal.game.resource.*;
    import mortal.game.view.arena.data.*;
    import mortal.game.view.common.*;

    public class HeroArenaWatchingListCellRenderer extends GCellRenderer
    {
        private var _roleName1:GTextFiled;
        private var _combat1:GTextFiled;
        private var _point1:GTextFiled;
        private var _pkIcon:GBitmap;
        private var _roleName2:GTextFiled;
        private var _combat2:GTextFiled;
        private var _point2:GTextFiled;
        private var _watchBtn:GLoadingButton;
        private var _watchingData:ArenaWatchingListData;

        public function HeroArenaWatchingListCellRenderer()
        {
            return;
        }// end function

        override protected function createDisposedChildrenImpl() : void
        {
            super.createDisposedChildrenImpl();
            var _loc_1:* = GlobalStyle.textFormatHuang;
            _loc_1.align = AlignMode.CENTER;
            _loc_1.size = 13;
            this._roleName1 = UIFactory.gTextField("", 0, 4, 92 + 5, 30, this, _loc_1);
            var _loc_2:* = GlobalStyle.textFormatBai;
            _loc_2.align = AlignMode.CENTER;
            _loc_2.size = 13;
            this._combat1 = UIFactory.gTextField("", 94 + 18, 4, 63, 20, this, _loc_2);
            this._point1 = UIFactory.gTextField("", 158 + 31, 4, 61, 20, this, _loc_1);
            this._pkIcon = UIFactory.gBitmap(ImagesConst.VsIcon, 224 + 37 - 7, 6 + 2, this);
            this._roleName2 = UIFactory.gTextField("", 264 + 27, 4, 92 + 5, 20, this, _loc_1);
            this._combat2 = UIFactory.gTextField("", 361 + 45, 4, 63, 20, this, _loc_2);
            this._point2 = UIFactory.gTextField("", 426 + 50, 4, 61, 20, this, _loc_1);
            this._watchBtn = UIFactory.gLoadingButton(ResFileConst.ArenaWatchBtn, 498 + 45 - 5, 4, 51, 23, this);
            this._watchBtn.configEventListener(MouseEvent.CLICK, this.onClickHandler);
            this.pushUIToDisposeVec(UIFactory.bg(-25, 29 + 4, 548 + 90, 2, this, ImagesConst.SplitLine));
            return;
        }// end function

        override public function set data(param1:Object) : void
        {
            super.data = param1;
            this._watchingData = param1 as ArenaWatchingListData;
            if (this._watchingData)
            {
                this._roleName1.text = this._watchingData.leftRoleName;
                this._combat1.text = this._watchingData.leftCombat + "";
                this._point1.text = this._watchingData.leftPoint + "";
                this._roleName2.text = this._watchingData.rightRoleName;
                this._combat2.text = this._watchingData.rightCombat + "";
                this._point2.text = this._watchingData.rightPoint + "";
                this._pkIcon.visible = true;
            }
            else
            {
                this._pkIcon.visible = false;
            }
            return;
        }// end function

        private function onClickHandler(event:MouseEvent) : void
        {
            if (this._watchingData)
            {
                GameProxy.copy.enterArenaOB(ECopyType._ECopyTypeArena2v2, this._watchingData.arenaId);
            }
            else
            {
                MsgManager.showRollTipsMsg(Language.getString(41522));
            }
            return;
        }// end function

        override protected function disposeImpl(param1:Boolean = true) : void
        {
            super.disposeImpl(param1);
            this._roleName1.dispose(param1);
            this._combat1.dispose(param1);
            this._point1.dispose(param1);
            this._pkIcon.dispose(param1);
            this._roleName2.dispose(param1);
            this._combat2.dispose(param1);
            this._point2.dispose(param1);
            this._watchBtn.dispose(param1);
            this._roleName1 = null;
            this._combat1 = null;
            this._point1 = null;
            this._pkIcon = null;
            this._roleName2 = null;
            this._combat2 = null;
            this._point2 = null;
            this._watchBtn = null;
            this._watchingData = null;
            return;
        }// end function

    }
}
